package select.comparators;

import java.util.Comparator;

import neural.Individual;

public class Maximize implements Comparator<Individual>{
	
	public Maximize(){
	}
	
	@Override
	public int compare(Individual val1, Individual val2) {
		Double aptitude1 = val1.getFitness();
		Double aptitude2 = val2.getFitness();
		
		if(aptitude1 == null && aptitude2 != null){
			return -1;
		}
		if(aptitude1 != null && aptitude2 == null){
			return 1;
		}
	
		return aptitude2.compareTo(aptitude1);
//		if(aptitude1 == aptitude2){
//			return 0;
//		}
//		else if(aptitude1 - aptitude2 > 0.0){
//			return 1;
//		}else{
//			return -1;
//		}
	}

}
